/**
  ******************************************************************************
  * @file    EEPROM_CFG.h
  * @author  Feirui_Joe
  * @version V0.1
  * @date    07/26/2010
  * @brief   Outputs Driver
  ******************************************************************************
  * @copy
  *
  * <h2><center>&copy; COPYRIGHT 2010 Feirui</center></h2>
  */ 



/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef  __EEPROM_CFG_H__
#define  __EEPROM_CFG_H__


#ifdef __cplusplus
 extern "C" {
#endif


/**
  * @brief  INCLUDE FILES.
  */


/**
  * @brief GLOBALS RAM definition
  */
#ifdef   EEPROM_CFG_GLOBALS
#define  EEPROM_CFG_EXT
#else
#define  EEPROM_CFG_EXT  extern
#endif


#define EEPROMPageAreaOrd_1             0
#define EEPROMPageAreaOrd_2             1

#define PageOrd_pcfgPage0               0  
#define PageOrd_pcfgPage1               1  
#define PageOrd_pcfgPage7               7  
#define PageOrd_pcfgPage114             114
#define PageOrd_pcfgPage128             128
#define PageOrd_pcfgPage129             129
#define PageOrd_pcfgPage130             130
#define PageOrd_pcfgPage131             131
#define PageOrd_pcfgPage132             132
#define PageOrd_pcfgPage133             133
#define PageOrd_pcfgPage134             134
#define PageOrd_pcfgPage135             135
#define PageOrd_pcfgPage136             136
#define PageOrd_pcfgPage137             137
#define PageOrd_pcfgPage138             138
#define PageOrd_pcfgPage139             139
#define PageOrd_pcfgPage140             140
#define PageOrd_pcfgPage219             219
#define PageOrd_pcfgPage96              96

#define EEPROMAdrOrd_pcfgPage0          0
#define EEPROMAdrOrd_pcfgPage1          1
#define EEPROMAdrOrd_pcfgPage7          2 
#define EEPROMAdrOrd_pcfgPage114        3 
#define EEPROMAdrOrd_pcfgPage128        4 
#define EEPROMAdrOrd_pcfgPage129        5 
#define EEPROMAdrOrd_pcfgPage130        6 
#define EEPROMAdrOrd_pcfgPage131        7 
#define EEPROMAdrOrd_pcfgPage132        8 
#define EEPROMAdrOrd_pcfgPage133        9 
#define EEPROMAdrOrd_pcfgPage134        10
#define EEPROMAdrOrd_pcfgPage135        11
#define EEPROMAdrOrd_pcfgPage136        12
#define EEPROMAdrOrd_pcfgPage137        13
#define EEPROMAdrOrd_pcfgPage138        14
#define EEPROMAdrOrd_pcfgPage139        15
#define EEPROMAdrOrd_pcfgPage140        16
#define EEPROMAdrOrd_pcfgPage219        17
#define EEPROMAdrOrd_pcfgPage96         18
#define EEPROMAdrOrd_Factory128         19
#define EEPROMAdrOrd_Factory129         20
#define EEPROMAdrOrd_Factory130         21
#define EEPROMAdrOrd_Factory131         22
#define EEPROMAdrOrd_Factory132         23
#define EEPROMAdrOrd_Factory133         24
#define EEPROMAdrOrd_Factory134         25
#define EEPROMAdrOrd_Factory135         26
#define EEPROMAdrOrd_Factory136         27
#define EEPROMAdrOrd_Factory137         28
#define EEPROMAdrOrd_Factory138         29
#define EEPROMAdrOrd_Factory139         30
#define EEPROMAdrOrd_Factory140         31
#define EEPROMAdrOrd_Factory219         32
#define EEPROMAdrOrd_pcfgTOTNum         33
EEPROM_CFG_EXT const uint16_t EEPROMpcfgPageA1AdrList[EEPROMAdrOrd_pcfgTOTNum];
EEPROM_CFG_EXT const uint16_t EEPROMpcfgPageA2AdrList[EEPROMAdrOrd_pcfgTOTNum];
EEPROM_CFG_EXT const uint16_t * const EEPROMpcfgDefaultAdrList[EEPROMAdrOrd_pcfgTOTNum];
EEPROM_CFG_EXT const uint8_t  EEPROMpcfgPagexSizeList[EEPROMAdrOrd_pcfgTOTNum];


/****************************************************/
/* StateUpdIn OS_Flags config bits */
#define OSEEPROMFlags_WRPage0                        ((OS_FLAGS)DEF_BIT_00)
#define OSEEPROMFlags_WRPage1                        ((OS_FLAGS)DEF_BIT_01)
#define OSEEPROMFlags_WRPage7                        ((OS_FLAGS)DEF_BIT_02)
#define OSEEPROMFlags_WRPage114                      ((OS_FLAGS)DEF_BIT_03)
#define OSEEPROMFlags_WRPage128                      ((OS_FLAGS)DEF_BIT_04)
#define OSEEPROMFlags_WRPage129                      ((OS_FLAGS)DEF_BIT_05)
#define OSEEPROMFlags_WRPage130                      ((OS_FLAGS)DEF_BIT_06)
#define OSEEPROMFlags_WRPage131                      ((OS_FLAGS)DEF_BIT_07)
#define OSEEPROMFlags_WRPage132                      ((OS_FLAGS)DEF_BIT_08)
#define OSEEPROMFlags_WRPage133                      ((OS_FLAGS)DEF_BIT_09)
#define OSEEPROMFlags_WRPage134                      ((OS_FLAGS)DEF_BIT_10)
#define OSEEPROMFlags_WRPage135                      ((OS_FLAGS)DEF_BIT_11)
#define OSEEPROMFlags_WRPage136                      ((OS_FLAGS)DEF_BIT_12)
#define OSEEPROMFlags_WRPage137                      ((OS_FLAGS)DEF_BIT_13)
#define OSEEPROMFlags_WRPage138                      ((OS_FLAGS)DEF_BIT_14)
#define OSEEPROMFlags_WRPage139                      ((OS_FLAGS)DEF_BIT_15)
#define OSEEPROMFlags_WRPage140                      ((OS_FLAGS)DEF_BIT_16)
#define OSEEPROMFlags_WRPage219                      ((OS_FLAGS)DEF_BIT_01)

#define OSEEPROMFlags_WRRecord                       ((OS_FLAGS)DEF_BIT_17)
#define OSEEPROMFlags_CoverRCA1                      ((OS_FLAGS)DEF_BIT_18)
#define OSEEPROMFlags_CoverRCA2                      ((OS_FLAGS)DEF_BIT_19)
#define OSEEPROMFlags_RstRecord                      ((OS_FLAGS)DEF_BIT_20)
#define OSEEPROMFlags_WRFactory                      ((OS_FLAGS)DEF_BIT_21)
#define OSEEPROMFlags_RDFactory                      ((OS_FLAGS)DEF_BIT_22)
#define OSFLASHFlags_GenRecordWR                     ((OS_FLAGS)DEF_BIT_23)
#define OSFLASHFlags_GenRecordRst                    ((OS_FLAGS)DEF_BIT_24)
#define OSFLASHFlags_AlarmDataWR                     ((OS_FLAGS)DEF_BIT_25)
#define OSFLASHFlags_AlarmDataRst                    ((OS_FLAGS)DEF_BIT_26)
#define OSFLASHFlags_RunDataWR                       ((OS_FLAGS)DEF_BIT_27)
#define OSFLASHFlags_RunDataRst                      ((OS_FLAGS)DEF_BIT_28)
#define OSFLASHFlags_OtherDataWR                     ((OS_FLAGS)DEF_BIT_29)
#define OSFLASHFlags_OtherDataRst                    ((OS_FLAGS)DEF_BIT_30)
#define OSEEPROMFlags_OperatResoult                  ((OS_FLAGS)DEF_BIT_31)

#define OSEEPROMFlags_UpdAccumu                      (OSEEPROMFlags_WRPage7 | OSEEPROMFlags_WRPage219)
#define OSEEPROMFlags_UpdCalib                       OSEEPROMFlags_WRPage114
#define OSEEPROMFlags_UpdPage1                       OSEEPROMFlags_WRPage1

#define OSEEPROMFlags_FillConfig                     (OSEEPROMFlags_WRPage1  | \
                                                      OSEEPROMFlags_WRPage128| \
                                                      OSEEPROMFlags_WRPage129| \
                                                      OSEEPROMFlags_WRPage130| \
                                                      OSEEPROMFlags_WRPage131| \
                                                      OSEEPROMFlags_WRPage132| \
                                                      OSEEPROMFlags_WRPage133| \
                                                      OSEEPROMFlags_WRPage134| \
                                                      OSEEPROMFlags_WRPage135| \
                                                      OSEEPROMFlags_WRPage136| \
                                                      OSEEPROMFlags_WRPage137| \
                                                      OSEEPROMFlags_WRPage138| \
                                                      OSEEPROMFlags_WRPage139| \
                                                      OSEEPROMFlags_WRPage140)

#define OSEEPROMFlags_ALL                            ((OS_FLAGS)0x7fffffff)
#define OSEEPROMFlags_DefaultValue                   ((OS_FLAGS)0x00000000)

#define EEPROMOSFlagOrd_WRPage0          0
#define EEPROMOSFlagOrd_WRPage1          1
#define EEPROMOSFlagOrd_WRPage7          2 
#define EEPROMOSFlagOrd_WRPage114        3 
#define EEPROMOSFlagOrd_WRPage128        4 
#define EEPROMOSFlagOrd_WRPage129        5 
#define EEPROMOSFlagOrd_WRPage130        6 
#define EEPROMOSFlagOrd_WRPage131        7 
#define EEPROMOSFlagOrd_WRPage132        8 
#define EEPROMOSFlagOrd_WRPage133        9 
#define EEPROMOSFlagOrd_WRPage134        10
#define EEPROMOSFlagOrd_WRPage135        11
#define EEPROMOSFlagOrd_WRPage136        12
#define EEPROMOSFlagOrd_WRPage137        13
#define EEPROMOSFlagOrd_WRPage138        14
#define EEPROMOSFlagOrd_WRPage139        15
#define EEPROMOSFlagOrd_WRPage140        16
#define EEPROMOSFlagOrd_WRPage219        17
#define EEPROMOSFlagOrd_WRRecord         18
#define EEPROMOSFlagOrd_CoverRCA1        19
#define EEPROMOSFlagOrd_CoverRCA2        20
#define EEPROMOSFlagOrd_RstRecord        21
#define EEPROMOSFlagOrd_Factory128       22
#define EEPROMOSFlagOrd_Factory129       23
#define EEPROMOSFlagOrd_Factory130       24
#define EEPROMOSFlagOrd_Factory131       25
#define EEPROMOSFlagOrd_Factory132       26
#define EEPROMOSFlagOrd_Factory133       27
#define EEPROMOSFlagOrd_Factory134       28
#define EEPROMOSFlagOrd_Factory135       29
#define EEPROMOSFlagOrd_Factory136       30
#define EEPROMOSFlagOrd_Factory137       31
#define EEPROMOSFlagOrd_Factory138       32
#define EEPROMOSFlagOrd_Factory139       33
#define EEPROMOSFlagOrd_Factory140       34
#define EEPROMOSFlagOrd_Factory219       35
#define EEPROMOSFlagOrd_pcfgTOTNum       36
EEPROM_CFG_EXT const OS_FLAGS OSEEPROMFlagsListBuffer[EEPROMOSFlagOrd_pcfgTOTNum];


/*****************************************/
#define CfgPageEEPROMWrite_Area1         0
#define CfgPageEEPROMWrite_Area2         1
#define CfgPageEEPROMWrite_Both          2

#define CfgWriteStaOrd_Page0             0 
#define CfgWriteStaOrd_Page1             1 
#define CfgWriteStaOrd_Page7             2  
#define CfgWriteStaOrd_Page114           3 
#define CfgWriteStaOrd_Page128           4 
#define CfgWriteStaOrd_Page129           5 
#define CfgWriteStaOrd_Page130           6 
#define CfgWriteStaOrd_Page131           7 
#define CfgWriteStaOrd_Page132           8 
#define CfgWriteStaOrd_Page133           9 
#define CfgWriteStaOrd_Page134           10
#define CfgWriteStaOrd_Page135           11
#define CfgWriteStaOrd_Page136           12
#define CfgWriteStaOrd_Page137           13
#define CfgWriteStaOrd_Page138           14
#define CfgWriteStaOrd_Page139           15
#define CfgWriteStaOrd_Page140           16
#define CfgWriteStaOrd_Page219           17
#define CfgWriteSta_TOTPageNum           (CfgWriteStaOrd_Page219+1)
EEPROM_CFG_EXT uint8_t CfgPagexxWriteSta[CfgWriteSta_TOTPageNum];

                                          /* App_Sem_EEPROMOP Start */
#define RecordOrd_AlarmBF0                0 
#define RecordOrd_AlarmBF1                1 
#define RecordOrd_AlarmBF2                2 
#define RecordOrd_AlarmBF3                3 
#define RecordOrd_AlarmBF4                4 
#define RecordOrd_AlarmBF5                5 
#define RecordOrd_AlarmBF6                6 
#define RecordOrd_AlarmBF7                7 
#define RecordOrd_Speed                   8
#define RecordOrd_Oil                     9 
#define RecordOrd_Temp                    10
#define RecordOrd_Fuel                    11
#define RecordOrd_Bat                     12
#define RecordOrd_Charge                  13
#define RecordOrd_Sensor1Type             14
#define RecordOrd_Sensor1Val              15
#define RecordOrd_Sensor2Type             16
#define RecordOrd_Sensor2Val              17
#define RecordOrd_MainVoltLN1H            18
#define RecordOrd_MainVoltLN1L            19
#define RecordOrd_MainVoltLN2H            20
#define RecordOrd_MainVoltLN2L            21
#define RecordOrd_MainVoltLN3H            22
#define RecordOrd_MainVoltLN3L            23
#define RecordOrd_MainVoltLL12H           24
#define RecordOrd_MainVoltLL12L           25
#define RecordOrd_MainVoltLL23H           26
#define RecordOrd_MainVoltLL23L           27
#define RecordOrd_MainVoltLL31H           28
#define RecordOrd_MainVoltLL31L           29
#define RecordOrd_MainPhaseL1             30
#define RecordOrd_MainPhaseL2             31
#define RecordOrd_MainFreq                32
#define RecordOrd_MainACSys               33 
#define RecordOrd_GenVoltLN1H             34
#define RecordOrd_GenVoltLN1L             35
#define RecordOrd_GenVoltLN2H             36
#define RecordOrd_GenVoltLN2L             37
#define RecordOrd_GenVoltLN3H             38
#define RecordOrd_GenVoltLN3L             39
#define RecordOrd_GenVoltLL12H            40
#define RecordOrd_GenVoltLL12L            41
#define RecordOrd_GenVoltLL23H            42
#define RecordOrd_GenVoltLL23L            43
#define RecordOrd_GenVoltLL31H            44
#define RecordOrd_GenVoltLL31L            45
#define RecordOrd_GenPhaseL1              46
#define RecordOrd_GenPhaseL2              47
#define RecordOrd_GenFreq                 48
#define RecordOrd_GenACSys                49
#define RecordOrd_GenCurrL1H              50
#define RecordOrd_GenCurrL1L              51
#define RecordOrd_GenCurrL2H              52
#define RecordOrd_GenCurrL2L              53
#define RecordOrd_GenCurrL3H              54
#define RecordOrd_GenCurrL3L              55
#define RecordOrd_GenPKWL1H               56
#define RecordOrd_GenPKWL1L               57
#define RecordOrd_GenPKWL2H               58
#define RecordOrd_GenPKWL2L               59
#define RecordOrd_GenPKWL3H               60
#define RecordOrd_GenPKWL3L               61
#define RecordOrd_GenPKvrL1H              62
#define RecordOrd_GenPKvrL1L              63
#define RecordOrd_GenPKvrL2H              64
#define RecordOrd_GenPKvrL2L              65
#define RecordOrd_GenPKvrL3H              66
#define RecordOrd_GenPKvrL3L              67
#define RecordOrd_GenPKVAL1H              68
#define RecordOrd_GenPKVAL1L              69
#define RecordOrd_GenPKVAL2H              70
#define RecordOrd_GenPKVAL2L              71
#define RecordOrd_GenPKVAL3H              72
#define RecordOrd_GenPKVAL3L              73
#define RecordOrd_GenPFactor1             74
#define RecordOrd_GenPFactor2             75
#define RecordOrd_GenPFactor3             76
#define RecordOrd_GenAVGPFactor           77
#define RecordOrd_GenEnergyKWH            78
#define RecordOrd_GenEnergyKWL            79
#define RecordOrd_GenEnergyKvrH           80
#define RecordOrd_GenEnergyKvrL           81
#define RecordOrd_GenNumStartTiH          82
#define RecordOrd_GenNumStartTiL          83
#define RecordOrd_GenRunningTiH           84
#define RecordOrd_GenRunningTiL           85
#define RecordOrd_InputsStatus            86
#define RecordOrd_RelaysStatus            87
#define RecordOrd_DateClock1              88
#define RecordOrd_DateClock2              89
#define RecordOrd_DateClock3              90
#define RecordOrd_DateClock4              91
#define RecordOrd_CheckSum                92
#define RecordOrd_TOTNum                  (RecordOrd_CheckSum+1)
#define RecordOrd_AlarmNum                (RecordOrd_AlarmBF7+1)
EEPROM_CFG_EXT uint16_t EventRecordBuffer[RecordOrd_TOTNum];

EEPROM_CFG_EXT uint8_t  RequestEventRecordUpd;



                                          /* App_Sem_EEPROMOP End */
/*****************************************/






#ifdef __cplusplus
}
#endif


#endif   /*  __EEPROM_CFG_H__  */

/******************* (C) COPYRIGHT 2010 Feirui *****END OF FILE****/